package com.sskj.functions.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.functions.activity.IncomeDetailActivity;
import com.sskj.lib.bean.IncomeDetailBean;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/07/16
 */
public class IncomeDetailPresenter extends BasePresenter<IncomeDetailActivity> {

    public void getIncomeList(boolean showLoading, String orderID, int page, int size) {
        httpService.getIncomeList(orderID, page, size)
                .tag(this)
                .execute(new JsonCallBack<HttpData<PageBean<IncomeDetailBean>>>(showLoading ? this : null) {
                    @Override
                    public void onSuccess(Response<HttpData<PageBean<IncomeDetailBean>>> response) {
                        mView.getIncomeListOK(response.body().getData().getList());
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.stopRefresh();
                    }
                });
    }
}
